<?php
namespace app\api\controller\v1;
/*
 * content : 用户登录类
 * Author  : Songyicong 
 * time    : 2018-05-02 09:21:27 
 * email   : m13726262373@163.com 
 */

 use app\api\controller\BaseController;
 use app\api\service\v1\LoginService;
 use app\api\service\v1\AdminService;

 class Login extends BaseController{

    // 开启ip检测
    public $ipAuth = true;
    protected $loginService;

    /** 初始化检测请求时间，签名 */
    public function __construct(){
        parent::__construct();
        $this->loginService = new LoginService();
        $this->adminService = new AdminService();
    }

    /** 登录后台用户 */
    public function getLoginAdmin(){
        $this->adminService->login($this->params);
    }

    /** 普通密码登录,返回open_id和权限值*/
    public function getLoginNormal(){
        $this->loginService->setLoginNormal($this->params);
    }

    /** 邮箱登录，返回open_id 和 权限值 */
    public function getLoginEmail(){
        $this->loginService->setLoginEmail($this->params);
    }

    /** 邮箱登录验证 */
    public function isVerifyEmailCode(){
        $this->loginService->isVerifyEmailCode($this->params);
    }

    /** 微信登录 */
    public function wechatLogin(){
        return redirect($this->loginService->setWechatLogin($this->params));
    }

    /** 微信回调 */
    public function wechatCallback(){
        $this->loginService->wechatCallback($this->params);
    }
 } 
